<?php
	/**
	 * 福利列表
	 */
    class  WelfareList extends APIBase {
		
		public $tag = "WelfareList";
		public $isLogin = true;
		
		public function before() {
			$this->initCacheRedis();
			$this->initMysql();
			return true;
		}

		public function logic() {
			$uid = $this->uid;
			$time = time();
			$signflag = 0;//1表示有小红点
			$benefitflag = 0;//1表示有小红点
			//获取领取救济金的次数
			$list = $this->data_redis->hMGet("hu:{$uid}",array('benefit_cnt','money'));
			$benefit_cnt = (int)$list['benefit_cnt'];
			$money = (int)$list['money'];
			if($money < Game::$broke_money && $benefit_cnt < Game::$broke_num_max){
				$benefitflag = 1;
			}
			//获取今天用户是否有签到
			$is_sign = $this->cache_redis->hGet("hSign:{$uid}",'is_sign');
			if((int)$is_sign == 0){
				$signflag = 1;
			}
			$dataArr = array('signflag'=>$signflag,'benefitflag'=>$benefitflag,'benefit_cnt'=>$benefit_cnt,'broke_money'=>Game::$broke_money);
			$this->returnData($dataArr);
		}
		
    	public function after() {
			$this->deinitCacheRedis();
		}
    }
?>
